import React from 'react';
// import classnames from 'classnames';
import { useLocation } from 'react-router-dom'
import './index.module.scss';
import { RightOutline } from 'antd-mobile-icons';
interface userProps {
  avatar: string | null;
  username: string;
  token?: string;
  onSetting?: () => void;
  style?: React.CSSProperties;
}
export default function UserHeader(props: userProps) {
  const { username, onSetting, style } = props;
  const location = useLocation().pathname;
  return (
    <>
      <div styleName="user-avatar">
        <img
          src="/src/pages/user/components/avatar/avatar.svg"
          alt=""
          onClick={onSetting}
        />
        <span styleName="user-name" style={style}>
          {username}
        </span>
      </div>
      <div styleName="switch-account" style={style}  onClick={onSetting}>
        <span></span>
        {location==='/user'?< RightOutline fontSize={13} />:''}
      </div>
    </>
  );
}